package com.estate.web.controller.message;

import com.estate.common.core.domain.AjaxResult;
import com.estate.system.service.message.AdvancedEmailSender;
import com.estate.system.service.message.TwilioSmsSender;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 消息发送
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/send/message")
public class MessageController {

    @Resource
    private TwilioSmsSender twilioSmsSender;

    @Resource
    private AdvancedEmailSender advancedEmailSender;

    @ApiOperation(value = "测试发送短信")
    @GetMapping(value = "/SMS")
    public AjaxResult testSendSMS() {
        twilioSmsSender.send("0413027079", "A test SMS Message");
        return AjaxResult.success();
    }

    @ApiOperation(value = "测试发送邮件")
    @GetMapping(value = "/Email")
    public AjaxResult testSendEmail() {
        advancedEmailSender.send("it@mcconnellbourn.com.au", "it@mcconnellbourn.com.au", "Test", "a test mail");
        return AjaxResult.success();
    }


}
